import onnx


def analyze(onnxfile, **kwargs):
    model = onnx.load(onnxfile)

    for node in model.graph.node:
        if node.name == 'BatchNormalization_4' or node.name == 'BatchNormalization_10':
            if node.op_type != 'Conv':
                return False

            attributes = node.attribute
            for attr in attributes:
                print('attr.name:', attr.name)
                if attr.name == 'kernel_shape':
                    v = attr.ints
                    if v != [1,1]:
                        return False 

                if attr.name == 'dilations':
                    v = attr.ints
                    if v != [1,1]:
                        return False

                if attr.name == 'strides':
                    v = attr.ints
                    if v != [1,1]:
                        return False

                if attr.name == 'pads':
                    v = attr.ints
                    if v != [0, 0, 0, 0]:
                        return False

                if attr.name == 'group':
                    v = attr.i
                    if node.name == 'BatchNormalization_4' and v != 64:
                        return False

                    if node.name == 'BatchNormalization_10' and v != 96:
                        return False                                            

    return True